{include file='imobile_header.tpl'}

<div id="topbar">
	<div id="leftnav"> 
		<a href="user_home.php"><img alt="home" src="./include/imobile/iwebkit/images/home.png" /></a>
	</div> 
	<div id="title"> 
		{lang_print id=11340038}
	</div> 
	<div id="rightbutton"><a href="user_messages_new.php">{lang_print id=11340032}</a></div>
</div>

<div id="contentlist">
	{capture assign='unread_messages'}{if $user_unread_pms > 0}({$user_unread_pms})</b>{else}{/if}{/capture}
	<div class="title">{lang_print id=780} {$unread_messages}</div>

{* CHECK IF THERE ARE NO MESSAGES IN INBOX *}
{if $total_pms == 0}
  <div class="boxerror"> 
  	{lang_print id=785}
  </div>

{* DISPLAY MESSAGES *}
{else}	  
	  
  <ul class="messages">
  {* LIST INBOX MESSAGES *}
  {section name=pm_loop loop=$pms}

    {* IF MESSAGE IS NEW, HIGHLIGHT ROW *}
    {if $pms[pm_loop].pm_read === FALSE}
      {assign var='row_class' value='messages_unread'}
    {else}
      {assign var='row_class' value='messages_read'}
    {/if}
	<li class="message {$row_class}">
		<a href='user_messages_view.php?pmconvo_id={$pms[pm_loop].pmconvo_id}#bottom'>
	    	<img src='{$pms[pm_loop].pm_user->user_photo('./images/nophoto.gif', TRUE)}' border='0' class='icon' alt="{lang_sprintf id=786 1=$pms[pm_loop].pm_user->user_displayname_short}">
            <span class="name">{$pms[pm_loop].pm_user->user_displayname}</span>
            <span class="subject">{$pms[pm_loop].pmconvo_subject}</span>
            <span class="comment">{$pms[pm_loop].pm_body|truncate:90|choptext:45:"<br>"}</span>
            <span class="date">{$datetime->cdate("`$setting.setting_timeformat` `$setting.setting_dateformat`", $datetime->timezone($pms[pm_loop].pm_date, $global_timezone))}</span>
		</a>
	</li>
  {/section}

  </ul>
 
  
{/if}


  
</div>

{include file='imobile_footer.tpl'}

